#ifndef REACTTOSENSORSALG_H_
#define REACTTOSENSORSALG_H_

#include "Driver.h"
#include <sensor_msgs/LaserScan.h>
#include <sensor_msgs/Range.h>

#include <string>
using namespace std;

class ReactToSensorsAlg {

public:

	// data received from sensors
	sensor_msgs::LaserScan::ConstPtr front_laser;
	sensor_msgs::Range::ConstPtr back_laser;
	sensor_msgs::Range::ConstPtr right_laser;
	sensor_msgs::Range::ConstPtr left_laser;
	sensor_msgs::Range::ConstPtr back_us;
	sensor_msgs::Range::ConstPtr right_us;
	sensor_msgs::Range::ConstPtr left_us;

	void frontLaserHandler(const sensor_msgs::LaserScan::ConstPtr& scan_msg) {

		// update received data
		front_laser = scan_msg;
	}

	void backLaserHandler(const sensor_msgs::Range::ConstPtr& scan_msg) {

		// update received data
		back_laser = scan_msg;
	}

	void backUSHandler(const sensor_msgs::Range::ConstPtr& scan_msg) {

		// update received data
		back_us = scan_msg;
	}

	void rightUSHandler(const sensor_msgs::Range::ConstPtr& scan_msg) {

		// update received data
		right_us = scan_msg;
	}

	void rightLaserHandler(const sensor_msgs::Range::ConstPtr& scan_msg) {

		// update received data
		right_laser = scan_msg;
	}

	void leftUSHandler(const sensor_msgs::Range::ConstPtr& scan_msg) {

		// update received data
		left_us = scan_msg;
	}

	void leftLaserHandler(const sensor_msgs::Range::ConstPtr& scan_msg) {

		// update received data
		left_laser = scan_msg;
	}

	// acts according to sensors data
	void virtual act(Driver& driver) = 0;

	virtual ~ReactToSensorsAlg() { }
};


#endif
